package co.yixiang.huiMin.service.impl;

import co.yixiang.huiMin.entity.YxUserWithdraw;
import co.yixiang.huiMin.mapper.YxUserWithdrawMapper;
import co.yixiang.huiMin.service.YxUserWithdrawService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;

/**
 * <p>
 * 用户提现 服务实现类
 * </p>
 *
 * @author Author
 * @since 2020-06-30
 */
@Service
public class YxUserMybatisWithdrawServiceImpl extends ServiceImpl<YxUserWithdrawMapper, YxUserWithdraw> implements YxUserWithdrawService {

    @Resource
    private YxUserWithdrawMapper yxUserWithdrawMapper;

    @Override
    public List<YxUserWithdraw> selectYxUserWithdraws() {
        QueryWrapper<YxUserWithdraw> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("withdraw_del",2).orderByAsc("withdraw_create_time");
        return yxUserWithdrawMapper.selectList(queryWrapper);
    }

    @Override
    public int updateYxUserWithdraws(YxUserWithdraw yxUserWithdraw) {
        yxUserWithdraw.setWithdrawTime(LocalDateTime.now());
        return yxUserWithdrawMapper.updateById(yxUserWithdraw);
    }
}
